package com.longge;

/**
 * @program: my-code
 * @description:
 * @author: longge
 * @create: 2021-04-30 02:12
 */
public class SubtractProductAndSum {

    public int subtractProductAndSum(int n) {
        int sum = 0, mul = 1;
        while (n != 0) {
            int i = n % 10;
            sum += i;
            mul *= i;
            n = n / 10;
        }
        return mul-sum;
    }
}
